$(function () {
    var eid = GetQueryString("eid");

    var sel = $.Params.create();
    sel.ajax("get", getMeetIP() + "build/" + eid, function (data) {
            var val = data;
            getMeet();
            $("#meetTitle").val(val.meetId);
            $("#buildTitle").val(val.buildTitle);
            $("#code").val(val.code);
    })

    $("#addData").on("click", function () {
        var meetId = $("#meetTitle").val();
        var buildTitle = $("#buildTitle").val();
        var code = $("#code").val();
        var addSel = $.Params.create();
        addSel.addParams("meetId", meetId);
        addSel.addParams("buildTitle", buildTitle);
        addSel.addParams("code", code);
        addSel.ajax("put", getMeetIP() + "build/"+eid, function (data) {
               window.location.href = "buildList.html";
        })
    })

    $("#cancelAdd").on("click", function () {
        history.go(-1);
    })

    function getMeet(){
        var meetSel = $.Params.create();
        meetSel.ajax("get", getMeetIP() + "meet", function (data) {
            var html = "<option value='0'>请选择会议</option>";
            if(data.count > 0){
                $.each(data.rows,function(i,val){
                    html+="<option value = '"+val.id+"'>"+val.meetTitle+"</option>";
                })
            }
           $("#meetTitle").html(html);
        })
    
    }
})